
<%@ page contentType="text/html;charset=utf-8" language="java"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html>
<head>
    <title>民警详情</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="<c:url value='/resource/wechat/css/frozen1.css'/>" />
    <link href="<c:url value='/resource/wx/newcss/main.css'/>" rel="stylesheet"/>
    <script src="<c:url value='/resource/js/jquery-2.0.min.js'/>"></script>
    <style type="text/css">
        .ui-form-item {
            position: relative;
            font-size: 16px;
            height: auto;
            min-height: 44px;
            line-height: 24px;
            padding: 5px 15px;
            display: flex;
        }
        .ui-form-item label,.ui-form-item input { min-height: 44px;padding: 10px 0;}
        .ui-form-item input,.ui-form-item p{ position: relative; padding:10px 0 0 95px;}
        .ui-border-b{border-bottom: 1px solid #e0e0e0}

    </style>
</head>
<body ontouchstart>

<section class="ui-container">
    <div class="demo-block">
        <div class="ui-form ui-border-t">
            <form action="#">
                <div class="ui-form-item ui-border-b">
                    <label>
                        管辖范围：
                    </label>
                    <!--<input id="address" type="text" value="" readonly="readonly" />-->
                    <p id="address"></p>
                </div>
                <div class="ui-form-item ui-border-b">
                    <label>
                        姓<span class="color_white">空空</span>名：
                    </label>
                    <%--<input id="policeName" type="text" value="" readonly="readonly"/>--%>
                    <p id="policeName"></p>
                </div>
                <div class="ui-form-item ui-border-b">
                    <label>
                        单<span class="color_white">空空</span>位：
                    </label>
                    <%--<input id="company" type="text" value="" readonly="readonly" />--%>
                    <p id="company"></p>
                </div>
                <div class="ui-form-item ui-border-b">
                    <label>
                        职<span class="color_white">空空</span>务：
                    </label>
                    <%--<input id="job" type="text" value="" readonly="readonly" />--%>
                    <p id="job"></p>
                </div>
                <div class="ui-form-item ui-border-b">
                    <label>
                        警<span class="color_white">空空</span>号：
                    </label>
                    <%--<input id="policeCode" type="text" value="" readonly="readonly" />--%>
                    <p id="policeCode"></p>
                </div>
                <div class="ui-form-item ui-border-b">
                    <label>
                        手<span class="color_white">空空</span>机：
                    </label>
                    <%--<input id="phone" type="text" value="" readonly="readonly" />--%>
                    <p id="phone"></p>
                </div>
                <%--<p class="mjxq_p">留言板</p>--%>
                <%--<div class="mjxq_lyb">--%>
                    <%--<textarea id="message" name="message" rows="5" cols="70%" autofocus="autofocus" placeholder="请输入留言内容，该内容将会以短信的形式发送给该民警" required></textarea>--%>
                <%--</div>--%>

            </form>
        </div>
    </div>
    <%--<div class="ui-btn-wrap">--%>
        <%--<button id="btn" class="ui-btn-lg ui-btn-primary" >--%>
            <%--&lt;%&ndash;<a id="btn" type="submit" href="#" class="ui-btn-lg ui-btn-primary"> 提交 </a>&ndash;%&gt;--%>
                <%--提交--%>
        <%--</button>--%>
    <%--</div>--%>
    <div style="display: none; position: relative; top: -150px;" id="errormessage">
        <section class="ui-container">
            <div class="ui-newstips-wrap">
                <div class="ui-newstips">
                    <div id="errormsg"></div>
                </div>
            </div>
        </section>
    </div>
</section>

</body>
<script type="text/javascript" src="<c:url value='/resource/wx/js/jquery-2.1.1.min.js'/>"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $.ajax({
            url : "<c:url value='/api/query/search/result/${id}'/>",
            type : "get",
            dataType : 'json',
            timeout : 6000,
            async : false,
            success : function(data) {
                $("#address").html(data.data.address);
                $("#policeName").html(data.data.policeName);
                $("#company").html(data.data.company);
                $("#job").html(data.data.job);
                $("#policeCode").html(data.data.policeCode);
                $("#phone").html(data.data.phone);
            }
            ,
            error: function () {
                finish("查询失败");
            }
        });
    })
    $(function () {
        $("#btn").click(function () {

            var message = $("#message").val();
            if (message == "") {
                $('#errormessage').show();
                $("#errormsg").html("请输入留言内容");
                setTimeout(function(){
                    $('#errormessage').hide();
                },1500);
                return false;
            }

            $.ajax({
                url: "<c:url value='/api/query/message'/>",
                data:{
                    "message":$("#message").val(),
                    "phone":$("#phone").text()
                },
                type:"POST",
                success:function(res){
                    //console.info(res.msg);
                    $('#btn').attr({"disabled":"disabled"});
                    $('#errormessage').show();
                    $("#errormsg").html(res.msg);
                    setTimeout(function(){
                        $('#errormessage').hide();
                    },1500);
                }
                ,
                error: function () {

                    $('#errormessage').show();
                    $("#errormsg").html("留言发送失败，稍后请重试!");
                    setTimeout(function(){
                        $('#errormessage').hide();
                    },1500);
                }
            })
        });
    })
</script>
</html>
